#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
struct person
{
    int id, grade;
    person(int a, int b) : id(a), grade(b)
    {
    }
};
bool compare(person& x, person& y) {
    if(x.grade != y.grade) return x.grade > y.grade;
    return x.id < y.id;
}
const int N = 5050;
int f[N];
int main()
{
    int n, m;
    cin >> n >> m;
    m = (int)m * 1.5;
    vector<person> a;
    for(int i = 0; i < n; i++) {
        int x, y;
        cin >> x >> y;
        f[i] = y;
        a.push_back(person(x, y));
    }
    sort(f, f + n, greater<int>());
    int level = f[m - 1];
    int cnt = 0;
    sort(a.begin(), a.end(), compare);
    for(auto& s : a) {
        if(s.grade >= level) {
            cnt++;
        }
    }
    cout << level << " " << cnt << endl;
    for(int i = 0; i < cnt; i++) {
        cout << a[i].id << " " << a[i].grade << endl;
    }
    return 0;
}